std::queue::queue

From Cppreference

Jump to: navigation, search
explicit queue( const Container& cont = Container() );
explicit queue( const Container& cont );
(1) (pre-C++0x version)
(C++0x version)

explicit queue( Container&& cont = Container() );
(2) (C++0x)
​queue( const queue& other );
(3)
​queue( queue&& other );
(4) (C++0x)
template< class Allocator >
explicit queue( const Allocator& alloc );
(5) (C++0x)
template< class Allocator >
queue( const Container& cont, const Allocator& alloc );
(6) (C++0x)
template< class Allocator >
queue( Container&& cont, const Allocator& alloc );
(7) (C++0x)
template< class Allocator >
queue( const queue& other, const Allocator& alloc );
(8) (C++0x)
template< class Allocator >
queue( queue&& other, const Allocator& alloc );
(9) (C++0x)

Constructs new underlying container of the container adaptor from a variety of data sources.

1) Constructs the underlying container c with the contents of cont. Effectively calls ​c(cont).

2) Constructs the underlying container c with the contents of cont using move semantics. Effectively calls ​c(std::move(cont)). Since cont has default value of ​Container(), this constructor can be used as default constructor.

3) Copy constructor. The adaptor is constructed with the contents of other. Effectively calls ​c(other.c). (implicitly declared)

4) Move constructor. The adaptor is constructed with the contents of other using move semantics. Effectively calls ​c(std::move(other.c)). (implicitly declared)


The versions (5-9) of the constructor can be used only if Container uses Allocator type as its allocator. Specifically, these versions of the constructor participate in the overload resolution only if {{{1}}}.

5) Constructs the underlying container using alloc as allocator. Effectively calls ​c(alloc).

6) Constructs the underlying container with the contents of cont and using alloc as allocator. Effectively calls ​c(cont, alloc).

7) Constructs the underlying container with the contents of cont using move semantics while utilising alloc as allocator. Effectively calls ​c(std::move(cont), alloc).

8) Constructs the adaptor with the contents of other and using alloc as allocator. Effectively calls ​c(athor.c, alloc).

9) Constructs the adaptor with the contents of other using move semantics while utilising alloc as allocator. Effectively calls ​c(std::move(other.c), alloc).

Contents

Parameters

alloc - allocator to use for all memory allocations of the underlying container
other - another container adaptor to be used as source to initialize the underlying container
cont - container to be used as source to initialize the underlying container

Complexity

Example

See also

operator=
assigns values to the container adaptor
(public member function)
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
In other languages